import React, { useEffect, useState } from 'react'
import PubSub from 'pubsub-js'
export default function Didi() {
    const [car,setCar]=useState('二手三轮')
 //在组件初始化的时候 订阅一次即可
 useEffect(()=>{
    PubSub.subscribe('qiche',(_,data)=>{
        setCar(data)
    })
 },[])

  return (
    <div>我是弟弟 我开我哥的{car}</div>
  )
}
